package www.openteam.com.presenter.realtime;

import android.util.Log;

import java.util.HashMap;
import java.util.List;

import www.openteam.com.base.BasePresenter;
import www.openteam.com.bean.DeliverGoods;
import www.openteam.com.contract.realtime.DeliverGoodsContract;
import www.openteam.com.model.realtime.DeliverGoodsModel;
import www.openteam.com.mvp.IModel;
import www.openteam.com.ui.realtime.DeliverGoodFragment;

/**
 * Created by kylin on 2016/12/20.
 */

public class DeliverGoodsPresenter extends
        BasePresenter<DeliverGoodFragment>
        implements DeliverGoodsContract.DeliverGoodsPresenter {
    private static final String TAG = DeliverGoodsPresenter.class.getSimpleName();

    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new DeliverGoodsModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {
        HashMap<String, IModel> map = new HashMap<>();
        map.put("queryDGM", models[0]);
        return map;
    }



    @Override
    public void queryDeliverGoods(String rdsno, String custid,
                                  long startDate,
                                  long endDate, String stype, String moreCom,int userId,String jMark,int pageSize) {
        ((DeliverGoodsModel) getiModelMap()
                .get("queryDGM"))
                .queryDeliverGoods(rdsno, custid, startDate, endDate,stype,moreCom,userId,jMark,pageSize,
                        new DeliverGoodsModel.DeliverGoodsOnListener() {
                            @Override
                            public void queryDGSuccess(List<DeliverGoods.DataEntity> data) {
                                getIView().queryDGSuccess(data);
                            }

                            @Override
                            public void queryDGFail(String failMsg) {
                                getIView().queryDGFail(failMsg);
                            }

                        });
    }
}
